#!/usr/bin/env node

const http = require('http');

http.createServer((req, res) =>{
     
    if(req.url === '/') {
      let buf = Buffer.from('<html><head><meta charset="utf-8"></head><body><h1>Hello 王顶</h1></body></html>';)
      res.setHeader('Content-Type','text/html');
      res.setHeader('Content-Length',`${html.length}`);
      res.end(html);
    } else {
      res.statusCode = 404;
      res.end('ok!');
    }
}).listen(8080);
